<template>
  <el-dialog
    v-model="dialogVisible"
    title="帮助说明"
    width="600px"
    :close-on-click-modal="false"
  >
    <div class="help-content">
      <slot>
        <div class="help-section">
          <h3>使用说明</h3>
          <p>这里是默认的帮助内容，请在使用时传入具体的帮助信息。</p>
        </div>
      </slot>
    </div>
    
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogVisible = false" size="large">关闭</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script setup>
import { ref, watch } from 'vue'

const props = defineProps({
  visible: {
    type: Boolean,
    default: false
  }
})

const emit = defineEmits(['update:visible'])

const dialogVisible = ref(false)

watch(() => props.visible, (val) => {
  dialogVisible.value = val
})

watch(dialogVisible, (val) => {
  emit('update:visible', val)
})
</script>

<style scoped>
.help-content {
  max-height: 400px;
  overflow-y: auto;
  padding: 0 10px;
}

.help-section {
  margin-bottom: 24px;
}

.help-section h3 {
  color: #303133;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #ebeef5;
}

.help-section p {
  color: #606266;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 8px 0;
}

.help-section ul {
  color: #606266;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  padding-left: 20px;
}

.help-section li {
  margin-bottom: 6px;
}

.help-section code {
  background-color: #f5f7fa;
  color: #e6a23c;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
</style> 